During the past two days, I have encountered the wide character problem:
Question 1: Why do we need to call setlocale (lc_all, "CHS") before using wsprintf to output Unicode-encoded strings "); for strings output by printf with multi-byte encoding,
Setlocale
Configure the region information.
Syntax: char * setlocale (INT category, const char * locale );
Return Value: String
Function types: operating system and environment
Description
This function is used to configure the region information
Previous ArticleArticleMedium, the wide character set to print Chinese characters, also need to set locale
There are not many locale. H files, and the source code of the header file is attached.
View code
/* * ** Locale.
File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_controls.py", line 6523, in __init__ _controls_.DatePickerCtrl_swiginit(self,_controls_.new_DatePickerCtrl(*args, **kwargs))wx._core.PyAssertionError: C++ assertion "strcmp(setlocale(LC_ALL, NULL)
Warning: setlocale: LC_CTYPE: cannot change locale, setlocalelc_ctypeSetlocale warning
I have been using iterm2 on mac for some time. The following warning is always reported when I log on to the server:Warning: setlocale: LC_CTYPE: cannot change
In the multi-byte character-wide conversion function provided by the C Runtime Library: mbstowcs ()/wcstombs (), the global variable locale (locale encoding) must be used ), to specify the encoding type of multi-byte characters
1. functions:
Used to
briefly summarizes the following methods
Unicode as the core
Using the GNU GetText
QT-based multilingual development tool: QT linguist
Unicode as the core
Reference: http://www.ibm.com/developerworks/cn/linux/l-cn-ccppglb/
Assertions
The unique purpose of the header file is to provide the definition of the macro assert. If the assertions are not true (expression = 0), the program will output a prompt message in the standard error stream and abort the program to call
A Brief Analysis of Linux internationalization and localization mechanism original address: http://www.oschina.net/question/12_7648
Linux is an international operating system. Its toolkit and device drivers support multi-language operations. This
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.